package com.iptv.grape.event.imp;

import com.google.gson.Gson;
import com.iptv.grape.BaseActivity;
import com.iptv.grape.bu.GrapeContext;
import com.iptv.grape.domain.Bookmark;
import com.iptv.grape.event.JSRequest;
import com.iptv.grape.event.msg.BookmarkData;
import com.iptv.grape.event.proc.IWebViewMessageProc;
import com.iptv.grape.video.XMediaPlayer;

public class AddResourcesInBookmark implements IWebViewMessageProc {

    private BookmarkData bookmarkData;
    @Override
    public void init(JSRequest jsRequest) {
        bookmarkData = new Gson().fromJson(jsRequest.getJson(), BookmarkData.class);
    }

    @Override
    public String procMessage(BaseActivity baseActivity, XMediaPlayer mediaPlayer) {
        GrapeContext.curGrapeContext().getBookmarkList().add(bookmarkData.getData());
        return "";
    }
}
